import React from 'react'
import { Link, withRouter } from 'react-router-dom'
import styles from './Back.styl'

const Back = props => {
    const { history, to } = props
    return (to
        ? <Link className={styles.link} to={to}>&lt; 返回</Link>
        : <a className={styles.link} onClick={() => history.go(-1)}>&lt; 返回</a>)
}

export default withRouter(Back)
